﻿using RuoVea.Gantt.Entity;

namespace RuoVea.Gantt.Models
{

    /// <summary>
    /// 任务列表
    /// </summary>
    public class TasksModel
    {
        public long id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string label { get; set; }
        /// <summary>
        /// 用户
        /// </summary>
        public string? user { get; set; }
        /// <summary>
        /// 父Id
        /// </summary>
        public int? parentId { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime start { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime end { get; set; }
        /// <summary>
        /// 耗时
        /// </summary>
        public long? duration { get; set; }
        /// <summary>
        /// 百分比*100
        /// </summary>
        public int? percent { get; set; }
        /// <summary>
        /// 类别Id
        /// </summary>
        public string? type { get; set; }

        public int? progress { get; set; }
        /// <summary>
        /// 是否展开 有子目录时才需要设置
        /// </summary>
        public bool? collapsed { get; set; }
        /// <summary>
        /// 紧前任务
        /// </summary>
        public int? dependentOns { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public List<int>? dependentOn { get { return new List<int> { dependentOns??0 }; } }

        /// <summary>
        /// 
        /// </summary>
        public string Color { get; set; }

        public string StartName { get; set; }
        public string StartColor { get; set; }

        public string PriorityName { get; set; }
        public string PriorityColor { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public StyleModel style
        {
            get
            {
              return  new StyleModel
                {
                    @base = new BaseModel
                    {
                        fill = Color,
                       
                    }
                };
            }
        }
    }

    public class StyleModel
    {
        public BaseModel @base { get; set; }
    }
    public class BaseModel
    {
        public string fill { get; set; }
        public string stroke { get; set; }  
    }
}
